using IQIGame.Onigao.Framework;

namespace IQIGame.Onigao.Game
{
    /// <summary>
    /// 管理器中心引用分布类
    /// 所有管理器都可以从这里获取，包括Framework底层的管理器，以及FrameworkExt（第二层/框架扩展层）里的管理器
    /// </summary>
    public partial class ManagerCenter : MonoBehaviourOptimized
    {
        #region FrameworkEntry底层相关的管理器
        public static MonoDriver MonoDriver { get; private set; }
        public static NetworkManager Network { get; private set; }
        public static ObjectPoolManager ObjectPoolMgr { get; private set; }
        public static ResManager Res { get; private set; }
        public static ProjectSettingManager ProjectSetting { get; private set; }
        #endregion

        #region 框架扩展层管理器
        public static UIManager UI { get; private set; }
        public static EntityManager Entity { get; private set; }
        public static GSceneManager Scene { get; private set; }
        public static BehaviacSettingManager Behaviac { get; private set; }
        public static AudioManager Audio { get; private set; }
        public static VideoManager Video { get; private set; }
        public static RenderManager Render { get; private set; }
        public static TimerManager Timer { get; private set; }
        public static TimelineManager Timeline { get; private set; }
        #endregion

        /// <summary>
        /// 整合底层FrameworkEntry的引用，由于框架的分层限制，无法像GF那样通过partial类合并为一个类，分开调用很不方便，所以这里统一引用一遍
        /// </summary>
        private void InitFrameworkMgrRefs()
        {
            MonoDriver = FrameworkEntry.MonoDriver;
            Network = FrameworkEntry.Network;
            ObjectPoolMgr = FrameworkEntry.ObjectPoolMgr;
            Res = FrameworkEntry.Res;
            ProjectSetting = FrameworkEntry.ProjectSetting;
        }

        /// <summary>
        /// 初始化框架扩展层管理器的引用
        /// </summary>
        private void InitFrameworkExtMgrRefs()
        {
            #region 可配置，有生命周期管理的Manager
            UI = GetModule<UIManager>();
            Entity = GetModule<EntityManager>();
            Scene = GetModule<GSceneManager>();
            Behaviac = GetModule<BehaviacSettingManager>();
            Audio = GetModule<AudioManager>();
            Video = GetModule<VideoManager>();
            Render = GetModule<RenderManager>();
            Timeline = GetModule<TimelineManager>();
            #endregion  可配置，有生命周期管理的Manager

            #region 轻量级全局Manager
            Timer = TimerManager.Instance;
            #endregion 轻量级全局Manager
        }
    }
}
